<template>
  <view>
    <view class="menu flex a-item" :class="{ clickMenu: selectIndex === index }" v-for="(item, index) in types" @tap="emit(item, index)">
      <view class="line" v-if="selectIndex === index"></view>
      <view class="menu_name">{{ item.name }}</view>
    </view>
    <view class="menu" style="height: 300rpx; width: 100%"></view>
  </view>
</template>

<script>
export default {
  name: 'typeMenu',
  props: {
    types: {
      type: Array,
      default: [],
    },
    selectIndex: {
      type: Number,
      default: -1,
    },
  },
  data() {
    return {}
  },
  methods: {
    emit(val, index) {
      this.$emit('update:selectIndex', index)
      this.$emit('change', val)
    },
  },
}
</script>

<style lang="scss" scoped>
.menu {
  font-size: 28rpx;
  height: 100rpx;
  color: #666666;
  font-family: PingFangSC;
  &_name{
    margin-left: 20rpx;
  }
}
.clickMenu {
  background-color: white !important;
  color: #26bb55;
  font-weight: bold;
  /* border-left: 6rpx solid #26bb55; */
  font-size: 28rpx;

}
.line {
  background-color: #26bb55;
  width: 6rpx;
  height: 32rpx;
  
  border-radius: 20rpx;
}
</style>
